package com.alibaba.nacos.config.server.jpa.repository;

import java.util.Optional;

import com.alibaba.nacos.config.server.jpa.entity.RolesEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.stereotype.Repository;

/**
 * @author
 * @date 2020-03-08 23:31
 */
@Repository
public interface RolesRepository extends BaseRepository<RolesEntity, Long> {

    @Modifying
    void deleteByRole(String role);

    @Modifying
    void deleteByUsernameAndRole(String username,String role);

    Page<RolesEntity> findAllByUsername(String username,Pageable pageable);

    Optional<RolesEntity> findByRoleAndUsername(String role, String username);
}
